package com.atguigu.gmall.feign.product;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.to.CategoryView;
import com.atguigu.gmall.product.entity.SkuImage;
import com.atguigu.gmall.product.entity.SkuInfo;
import com.atguigu.gmall.product.entity.SpuSaleAttr;
import com.atguigu.gmall.product.to.ValueSkuJson;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author:lyd
 * @Date:2023/8/18 20:39
 * @Version:1.0
 * @Description
 **/
@FeignClient(value = "service-product",
        contextId = "SkuDetailItemFeignClient")
@RequestMapping("/api/inner/product")
public interface SkuDetailItemFeignClient {

    /**
     * 查询三级分类层级路径
     *
     * @param c3Id 当前商品的三级分类ID
     * @return
     */
    @GetMapping("/categoryview/{c3Id}")
    Result<CategoryView> getCategoryView(@PathVariable("c3Id") Long c3Id);


    /**
     * 获取skuInfo的基本信息
     *
     * @param skuId
     * @return
     */
    @GetMapping("/skuinfo/{skuId}")
    Result<SkuInfo> getSkuinfo(@PathVariable("skuId") Long skuId);


    /**
     * 获取skuId获取商品的价格
     *
     * @param skuId
     * @return
     */
    @GetMapping("/price/{skuId}")
    Result<BigDecimal> getPrice(@PathVariable("skuId") Long skuId);


    /**
     * 获取商品图片
     *
     * @param skuId
     * @return
     */
    @GetMapping("/images/{skuId}")
    Result<List<SkuImage>> getImages(@PathVariable("skuId") Long skuId);

    /**
     * 查询当前sku对应的spu定义的所有销售属性名和值，以及选中当前spu对应的哪一种组合
     *
     * @param spuId
     * @param skuId
     * @return
     */
    @GetMapping("/spusaleattr/{spuId}/{skuId}")
    Result<List<SpuSaleAttr>> getSpuSaleAttr(@PathVariable("spuId") Long spuId,
                                             @PathVariable("skuId") Long skuId);


    @GetMapping("/valuesskuJson/{spuId}")
    Result<String> getValueSkuJson(@PathVariable("spuId") Long spuId);
}



